{extend name="admin@main"}

{block name="content"}

<div>
    <div class="layui-card layui-form">
        <div class="layui-card-body think-box-shadow padding-bottom-5">
            <div class="layui-form-item margin-bottom-0">
                <label class="layui-form-label">Auth<br><span class="nowrap color-desc">授权方式</span></label>
                <div class="layui-input-block">
                    {foreach ['api'=>'公众号平台API模式','thr'=>'第三方平台授权模式','test'=>'接口功能测试'] as $k=>$v}
                    <input type="radio" data-wechat-type="{$k}" name="wechat_type" value="{$k}" title="{$v}" lay-filter="wechat_type">
                    {/foreach}
                    <p class="help-block">请选择微信对接方式，其中第三方平台授权需要微信开放平台支持，同时需要搭建 SERVICE 服务！</p>
                </div>
            </div>
        </div>
    </div>
    <div class="think-box-shadow ">
        <div class="layui-anim layui-anim-upbit" data-type="api">{include file='config/options_api'}</div>
        <div class="layui-anim layui-anim-upbit" data-type="thr">{include file='config/options_thr'}</div>
        <div class="layui-anim layui-anim-upbit" data-type="test">{include file='config/options_help'}</div>
    </div>
</div>

{/block}

{block name='script'}
<script>
    $(function () {
        apply('{:sysconf("wechat_type")}');
        window.form.render();
        window.form.on('radio(wechat_type)', function (data) {
            apply(data.value);
        });

        function apply(value) {
            this.$active = $("[data-wechat-type='" + value + "']").trigger('click');
            if (this.$active.size() < 1) $("[data-wechat-type]:first").trigger('click');
            $('[data-type="' + value + '"]').show().siblings('[data-type]').hide();
        }
    });
</script>
{/block}
